<template>
    <div class="news">
        <!-- 导航区 -->
        <ul>
            <li v-for="(item, index) in newList" :key="item.id">
                <!--第1种写法-->
                <!-- <RouterLink :to="`/news/detail/${item.id}/${item.title}/${item.content}`">{{ item.title }}</RouterLink> -->
                <!--第2种写法-->
                <!-- params 传参需要注意,1,提前在声明路由规则时占位;2,to使用对象写法时,只能用命名路由;3,不能传对象或数组 -->
                <RouterLink :to="{
                    name: 'nDetail', query: { id: item.id, title: item.title, content: item.content }
                }">{{ item.title }}</RouterLink>
            </li>
        </ul>
        <!-- 展示区 -->
        <div class="news-content">
            <RouterView />
        </div>
    </div>
</template>
<script lang="ts">
export default {
    name: 'News',
}
</script>
<script setup lang="ts">
import { reactive } from 'vue'
let newList = reactive([
    { id: "n1", title: "新闻1", content: "新闻内容001" },
    { id: "n2", title: "新闻2", content: "新闻内容002" },
    { id: "n3", title: "新闻3", content: "新闻内容003" },
    { id: "n4", title: "新闻4", content: "新闻内容004" },
])
</script>
<style scoped>
.news {
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    height: 100%;
}

.news ul {
    margin-top: 30px;
    /* list-style: none; */
    padding-left: 10px;
}

.news li::marker {
    color: #64967E;
}

.news li>a {
    font-size: 18px;
    line-height: 40px;
    text-decoration: none;
    color: #64967E;
    text-shadow: 0 0 1px rgb(0, 84, 0);
}

.news-content {
    width: 70%;
    height: 90%;
    border: 1px solid;
    margin-top: 20px;
    border-radius: 10px;
}
</style>